<template>
	<div class="index">
		<Header></Header>
		<!-- 内容 -->
		<div class="w65 ma">
			<!-- 面包屑 -->
			<breadcrumb></breadcrumb>
		</div>
		<div class="conent-top">
			<div class="w65 ma p05 pt2">
				<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="220px" class="demo-ruleForm">
					<el-row>
						<el-col :span="8">
							<el-form-item label="文件" prop="image">
								<!-- 导入人员档案 -->
								<!--  action 放的是导入文件的后台地址 -->
								<el-upload
									ref="upload"
									name="file"
									:limit="limit"
									:auto-upload="false"
									action="接口地址"
									:on-exceed="handleExceed"
									:file-list="filelist"
									:on-change="handleChansge"
								>
									<el-button slot="trigger" size="small" type="primary">选取文件</el-button>
									<el-button style="margin-left: 10px;" size="small" type="success" @click="postfile" :disabled="btn.disable">{{ btn.message }}</el-button>
									<div slot="tip" class="el-upload__tip">请上传为zip,rar格式的文件</div>
								</el-upload>
								<!-- 此处可以写导入时出现的详细错误信息，包含第几行出现问题显示出来 -->
								<div v-for="o in errmesg" :key="o.message" class="text item">{{ o.message }}</div>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="分类号" prop="classification_number">
								<el-input style="width: 16rem;" clearable placeholder="请输入分类号" v-model="ruleForm.classification_number"></el-input>
							</el-form-item>
							<el-form-item label="电子文档号" prop="electronic_document_number">
								<el-input style="width: 16rem;" clearable placeholder="请输入电子文档号" v-model="ruleForm.electronic_document_number"></el-input>
							</el-form-item>
							<el-form-item label="档号" prop="reference">
								<el-input style="width: 16rem;" clearable placeholder="请输入档号" v-model="ruleForm.reference"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="档案馆代码" prop="archives_code">
								<el-input style="width: 16rem;" clearable placeholder="请输入档案馆代码" v-model="ruleForm.archives_code"></el-input>
							</el-form-item>
							<el-form-item label="全国馆档号" prop="National_library_number">
								<el-input style="width: 16rem;" placeholder="请输入全国馆档号" v-model="ruleForm.National_library_number"></el-input>
							</el-form-item>
							<el-form-item label="汇交类别" prop="remittance_category">
								<el-input style="width: 16rem;" placeholder="请输入汇交类别" v-model="ruleForm.remittance_category"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="汇交联单号" prop="Remittance_No">
								<el-input style="width: 16rem;" clearable placeholder="请输入汇交联单号" v-model="ruleForm.Remittance_No"></el-input>
							</el-form-item>
							<el-form-item label="题名" prop="title">
								<el-input style="width: 16rem;" clearable placeholder="请输入题名" v-model="ruleForm.title"></el-input>
							</el-form-item>
							<el-form-item label="形成单位" prop="Formation_unit">
								<el-input style="width: 16rem;" clearable placeholder="请输入形成单位" v-model="ruleForm.Formation_unit"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="编著者" prop="Contributors">
								<el-input style="width: 16rem;" clearable placeholder="请输入编著者" v-model="ruleForm.Contributors"></el-input>
							</el-form-item>
							<el-form-item label="稿本代码" prop="Manuscript_code">
								<el-input style="width: 16rem;" clearable placeholder="请输入稿本代码" v-model="ruleForm.Manuscript_code"></el-input>
							</el-form-item>
							<el-form-item label="稿本" prop="manuscript">
								<el-input style="width: 16rem;" clearable placeholder="请输入稿本" v-model="ruleForm.manuscript"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="文种代码" prop="Language_code">
								<el-input style="width: 16rem;" clearable placeholder="请输入文种代码" v-model="ruleForm.Language_code"></el-input>
							</el-form-item>
							<el-form-item label="文种" prop="Language">
								<el-input style="width: 16rem;" clearable placeholder="请输入文种" v-model="ruleForm.Language"></el-input>
							</el-form-item>
							<el-form-item label="语种代码" prop="languages_code">
								<el-input style="width: 16rem;" clearable placeholder="请输入语种代码" v-model="ruleForm.languages_code"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="语种" prop="languages">
								<el-input style="width: 16rem;" clearable placeholder="请选择语种" v-model="ruleForm.languages"></el-input>
							</el-form-item>
						</el-col>
						<!-- <el-col :span="8">
							<el-form-item label="密级代码" prop="Security_code">
								<el-input style="width: 16rem;" clearable placeholder="请输入密级代码" v-model="ruleForm.Security_code"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="密级" prop="Security">
								<el-input style="width: 16rem;" clearable placeholder="请输入密级" v-model="ruleForm.Security"></el-input>
							</el-form-item>
						</el-col> -->
						<el-col :span="8">
							<el-form-item label="保管期限及代码" prop="Storage_period_and_code">
								<el-input style="width: 16rem;" clearable placeholder="请输入保管期限及代码" v-model="ruleForm.Storage_period_and_code"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="保管期限" prop="Storage_period">
								<el-input clearable style="width: 16rem;" placeholder="请输入保管期限" v-model="ruleForm.Storage_period"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="保护期" prop="Protection_period">
								<el-input clearable style="width: 16rem;" placeholder="请输入保护期" v-model="ruleForm.Protection_period"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="报告形成时间" prop="Report_formation_time">
								<el-date-picker
									v-model="ruleForm.Report_formation_time"
									clearable
									style="width: 16rem;"
									type="date"
									placeholder="请选择报告形成时间"
								></el-date-picker>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<!-- <el-form-item label="工作开始日期" prop="start_time">
								<el-date-picker v-model="ruleForm.start_time" clearable style="width: 16rem;" type="date" placeholder="请选择工作开始日期"></el-date-picker>
							</el-form-item> -->
							<el-form-item label="工作开始日期" prop="start_time">
								<el-date-picker
									style="width: 16rem;"
									value-format="yyyy-MM-dd"
									clearable
									v-model="daterange"
									@change="selDaterange"
									type="daterange"
									range-separator="至"
									start-placeholder="开始日期"
									end-placeholder="结束日期"
								></el-date-picker>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="评审时间" prop="Review_time">
								<el-date-picker v-model="ruleForm.Review_time" clearable style="width: 16rem;" type="date" placeholder="请选择评审时间"></el-date-picker>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="审批机构" prop="examining_and_approving_body">
								<el-input clearable style="width: 16rem;" placeholder="请输入审批机构" v-model="ruleForm.examining_and_approving_body"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="审批机构级别代码" prop="examining_lv_code">
								<el-input clearable style="width: 16rem;" placeholder="请输入审批机构级别代码" v-model="ruleForm.examining_lv_code"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="审批机构级别" prop="examining_lv">
								<el-input clearable style="width: 16rem;" placeholder="请输入审批机构级别" v-model="ruleForm.examining_lv"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="起始经度" prop="Initial_longitude">
								<el-input clearable style="width: 16rem;" placeholder="请输入起始经度" v-model="ruleForm.Initial_longitude"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="起始经度（度）" prop="Initial_longitude_d">
								<el-input clearable style="width: 16rem;" placeholder="请输入起始经度（度）" v-model="ruleForm.Initial_longitude_d"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="起始经度（分）" prop="Initial_longitude_f">
								<el-input clearable style="width: 16rem;" placeholder="请输入起始经度（分）" v-model="ruleForm.Initial_longitude_f"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="起始经度（秒）" prop="Initial_longitude_m">
								<el-input clearable style="width: 16rem;" placeholder="请输入起始经度（秒）" v-model="ruleForm.Initial_longitude_m"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="终止经度" prop="End_longitude">
								<el-input clearable style="width: 16rem;" placeholder="请输入终止经度" v-model="ruleForm.End_longitude"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="终止经度（度）" prop="End_longitude_d">
								<el-input clearable style="width: 16rem;" placeholder="请输入终止经度（度）" v-model="ruleForm.End_longitude_d"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="终止经度（分）" prop="End_longitude_f">
								<el-input clearable style="width: 16rem;" placeholder="请输入终止经度（分）" v-model="ruleForm.End_longitude_f"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="终止经度（秒）" prop="End_longitude_m">
								<el-input clearable style="width: 16rem;" placeholder="请输入终止经度（秒）" v-model="ruleForm.End_longitude_m"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="起始纬度" prop="Starting_latitude">
								<el-input clearable style="width: 16rem;" placeholder="请输入起始纬度" v-model="ruleForm.Starting_latitude"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="起始纬度（度）" prop="Starting_latitude_d">
								<el-input clearable style="width: 16rem;" placeholder="请输入起始纬度（度）" v-model="ruleForm.Starting_latitude_d"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="起始纬度（分）" prop="Starting_latitude_f">
								<el-input clearable style="width: 16rem;" placeholder="请输入起始纬度（分）" v-model="ruleForm.Starting_latitude_f"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="起始纬度（秒）" prop="Starting_latitude_m">
								<el-input clearable style="width: 16rem;" placeholder="请输入起始纬度（秒）" v-model="ruleForm.Starting_latitude_m"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="终止纬度" prop="End_latitude">
								<el-input clearable style="width: 16rem;" placeholder="请输入终止纬度" v-model="ruleForm.End_latitude"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="终止纬度（度）" prop="End_latitude_d">
								<el-input clearable style="width: 16rem;" placeholder="请输入终止纬度（度）" v-model="ruleForm.End_latitude_d"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="终止纬度（分）" prop="End_latitude_f">
								<el-input clearable style="width: 16rem;" placeholder="请输入终止纬度（分）" v-model="ruleForm.End_latitude_f"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="终止纬度（秒）" prop="End_latitude_m">
								<el-input clearable style="width: 16rem;" placeholder="请输入终止纬度（秒）" v-model="ruleForm.End_latitude_m"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="行政区名称代码序列" prop="region_name_code">
								<el-input clearable style="width: 16rem;" placeholder="请输入行政区名称代码序列" v-model="ruleForm.region_name_code"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="行政区名称序列" prop="region_name">
								<el-input clearable style="width: 16rem;" placeholder="请输入行政区名称序列以空格分开" v-model="ruleForm.region_name"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="工作程度代码" prop="Work_level_code">
								<el-input clearable style="width: 16rem;" placeholder="请输入工作程度代码" v-model="ruleForm.Work_level_code"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="工作程度" prop="Work_level">
								<el-input clearable style="width: 16rem;" placeholder="请输入工作程度" v-model="ruleForm.Work_level"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="资料类别代码" prop="Data_category_code">
								<el-input clearable style="width: 16rem;" placeholder="请输入资料类别代码" v-model="ruleForm.Data_category_code"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="资料类别" prop="Data_category">
								<el-input clearable style="width: 16rem;" placeholder="请输入资料类别" v-model="ruleForm.Data_category"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="投资主体" prop="Investors">
								<el-input clearable style="width: 16rem;" placeholder="请输入投资主体" v-model="ruleForm.Investors"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="主题词" prop="Key_words">
								<el-input clearable style="width: 16rem;" placeholder="请输入主题词" v-model="ruleForm.Key_words"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="矿产名称代码" prop="name_code_of_mineral">
								<el-input clearable style="width: 16rem;" placeholder="请输入矿产名称代码" v-model="ruleForm.name_code_of_mineral"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="矿产名称序列" prop="mineral_name_sequence">
								<el-input clearable style="width: 16rem;" placeholder="请输入矿产名称序列" v-model="ruleForm.mineral_name_sequence"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="子目录号" prop="Subdirectory_number">
								<el-input clearable style="width: 16rem;" placeholder="请输入子目录号" v-model="ruleForm.Subdirectory_number"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="形成时间（子目录）" prop="Subdirectory_time">
								<el-date-picker v-model="ruleForm.Subdirectory_time" clearable style="width: 16rem;" type="date" placeholder="请选择形成时间"></el-date-picker>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="子目题名" prop="Starting_latitude">
								<el-input clearable style="width: 16rem;" placeholder="请输入子目题名" v-model="ruleForm.Starting_latitude"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="形成单位" prop="Formation_unit_c">
								<el-input clearable style="width: 16rem;" placeholder="请输入形成单位" v-model="ruleForm.Formation_unit_c"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="文数" prop="Number_of_papers">
								<el-input clearable style="width: 16rem;" placeholder="请输入文数" v-model="ruleForm.Number_of_papers"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="页数" prop="the_number_of_pages">
								<el-input clearable style="width: 16rem;" placeholder="请输入页数" v-model="ruleForm.the_number_of_pages"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="正文备注" prop="Notes_to_the_text">
								<el-input clearable style="width: 16rem;" placeholder="请输入正文备注" v-model="ruleForm.Notes_to_the_text"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="附图" prop="the_figures">
								<el-input clearable style="width: 16rem;" placeholder="请输入附图" v-model="ruleForm.the_figures"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="附图备注" prop="Notes_to_the_figures">
								<el-input clearable style="width: 16rem;" placeholder="请输入附图备注" v-model="ruleForm.Notes_to_the_figures"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="附件" prop="enclosure">
								<el-input clearable style="width: 16rem;" placeholder="请输入附件" v-model="ruleForm.enclosure"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="附件备注" prop="enclosure_notes">
								<el-input clearable style="width: 16rem;" placeholder="请输入附件备注" v-model="ruleForm.enclosure_notes"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="附表" prop="Schedule">
								<el-input clearable style="width: 16rem;" placeholder="请输入附表" v-model="ruleForm.Schedule"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="附表备注" prop="Schedule_notes">
								<el-input clearable style="width: 16rem;" placeholder="请输入附表备注" v-model="ruleForm.Schedule_notes"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="审批书" prop="Letter_of_approval">
								<el-input clearable style="width: 16rem;" placeholder="请输入审批书" v-model="ruleForm.Letter_of_approval"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="多媒体" prop="Multi_Media">
								<el-input clearable style="width: 16rem;" placeholder="请输入多媒体" v-model="ruleForm.Multi_Media"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="多媒体备注" prop="Multi_Media_notes">
								<el-input clearable style="width: 16rem;" placeholder="请输入多媒体备注" v-model="ruleForm.Multi_Media_notes"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="档案盒数" prop="Number_of_file_boxes">
								<el-input clearable style="width: 16rem;" placeholder="请输入档案盒数" v-model="ruleForm.Number_of_file_boxes"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="汇交人名称" prop="Name_of_remitter">
								<el-input clearable style="width: 16rem;" placeholder="请输入汇交人名称" v-model="ruleForm.Name_of_remitter"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="附注/备注" prop="Notes_remarks">
								<el-input clearable style="width: 16rem;" placeholder="请输入附注/备注" v-model="ruleForm.Notes_remarks"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="备注" prop="remark">
								<el-input clearable style="width: 16rem;" placeholder="请输入备注" v-model="ruleForm.remark"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="原本保存单位及地点" prop="preservation_unit">
								<el-input clearable style="width: 16rem;" placeholder="请输入原本(成果)保存单位及地点" v-model="ruleForm.preservation_unit"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="实物资料保存位及地点" prop="physical_data_uni">
								<el-input clearable style="width: 16rem;" placeholder="请输入实物资料保存位及地点" v-model="ruleForm.physical_data_uni"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="FTP路径" prop="ftp_path">
								<el-input clearable style="width: 16rem;" placeholder="请输入FTP路径" v-model="ruleForm.ftp_path"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="状态" prop="status">
								<el-input clearable style="width: 16rem;" placeholder="请输入状态" v-model="ruleForm.status"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="填表人" prop="Completed_by">
								<el-input clearable style="width: 16rem;" placeholder="请输入填表人" v-model="ruleForm.Completed_by"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="录入人" prop="Entered_by">
								<el-input clearable style="width: 16rem;" placeholder="请输入录入人" v-model="ruleForm.Entered_by"></el-input>
							</el-form-item>
						</el-col>
						<!-- <el-col :span="8">
							<el-form-item label="审核人" prop="Reviewer">
								<el-input clearable style="width: 16rem;" placeholder="请输入审核人" v-model="ruleForm.Reviewer"></el-input>
							</el-form-item>
						</el-col> -->
						<el-col :span="8">
							<el-form-item label="录入日期" prop="Input_date">
								<el-date-picker clearable style="width: 16rem;" v-model="ruleForm.Input_date" type="date" placeholder="请选择录入日期"></el-date-picker>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="档案馆名称" prop="Name_of_Archives">
								<el-input clearable style="width: 16rem;" placeholder="请输入档案馆名称" v-model="ruleForm.Name_of_Archives"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="光盘号" prop="Disc_number">
								<el-input clearable style="width: 16rem;" placeholder="请输入光盘号" v-model="ruleForm.Disc_number"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="类型" prop="type">
								<el-select clearable style="width: 16rem;" v-model="ruleForm.type" placeholder="请选择类型">
									<el-option v-for="(item, index) in type" :key="item.index" :label="item.label" :value="item.id"></el-option>
								</el-select>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="分类" prop="stype">
								<el-select clearable style="width: 16rem;" v-model="ruleForm.stype" placeholder="请选择分类">
									<el-option v-for="item in optionsDrillType" :key="item.drill_type" :label="item.label" :value="item.drill_type"></el-option>
								</el-select>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="审批人" prop="s_id">
								<el-select style="width: 16rem;" clearable v-model="ruleForm.s_id" placeholder="请选择审批人">
									<el-option v-for="item in optionsName" :key="item.id" :label="item.username" :value="item.id"></el-option>
								</el-select>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="汇交日期" prop="Remittance_date">
								<el-date-picker clearable style="width: 16rem;" v-model="ruleForm.Remittance_date" type="date" placeholder="请选择汇交日期"></el-date-picker>
							</el-form-item>
						</el-col>
					</el-row>
					<el-row :gutter="20">
						<el-col :span="12" :offset="8">
							<el-form-item>
								<el-button class="btnSubmit" type="primary" :loading="loading" @click="submitForm('ruleForm')">
									<span v-if="!loading">提交审核</span>
									<span v-else>提交审核中...</span>
								</el-button>
							</el-form-item>
						</el-col>
					</el-row>
				</el-form>
			</div>
		</div>
		<!-- 底部 -->
		<Footer></Footer>
	</div>
</template>

<script>
import breadcrumb from '@/components/breadcrumb .vue';
import { getItem } from '@/utils/storage.js';
import { upload, approval, addInformationFiles } from '@/api/drill.js';
export default {
	name: 'addDrill',
	components: {
		breadcrumb
	},
	data() {
		return {
			//文件
			file: '',
			filename: '',
			limit: 1,
			filelist: [],
			errmesg: [],
			btn: {
				disable: false,
				message: '上传服务器'
			},

			ruleForm: {
				files: null,
				start_time: null,
				end_time: null,
				del_id: '',
				remark: '',
				token: getItem('token')
			},
			optionsName: [], //审核人
			daterange: [],
			loading: false,
			rules: {
				s_id: [{ required: true, message: '请选择审核批人', trigger: 'change' }],
				start_time: [{ required: true, message: '请选择工作开始日期', trigger: 'change' }]
			},
			type: [
				{
					label: '成果',
					id: '成果'
				},
				{
					label: '原始',
					id: '原始'
				}
			],
			optionsDrillType: [
				{
					label: '城市地质',
					drill_type: 1
				},
				{
					label: '地热资源',
					drill_type: 2
				},
				{
					label: '区域海洋',
					drill_type: 3
				}
			]
		};
	},
	created() {
		let data = {
			token: getItem('token')
		};
		approval(data).then(res => {
			this.optionsName = res.data;
		});
		if (this.$route.query.updateVal == '1') {
			let getData = this.$route.query.val;
			this.ruleForm = getData;
			this.ruleForm.del_id = getData.id;
			this.ruleForm.token = getItem('token');
			this.ruleForm.s_id = '';
			this.ruleForm.stype = parseInt(getData.stype);
			let fileName = {
				name: this.$route.query.val.files
			};
			this.filelist.push(fileName);
			this.daterange.push(getData.start_time, getData.end_time);
		}
	},
	methods: {
		// //选择日期区间
		selDaterange(val) {
			this.ruleForm.start_time = val[0];
			this.ruleForm.end_time = val[1];
		},
		handleExceed() {
			// 判断是否只能上传一个文件，超过提示报错
			this.$notify.error({
				title: '错误',
				message: '只能上传一个文件哦'
			});
		},
		handleChansge(file) {
			if (!/\.(zip|rar)$/.test(file.name)) {
				console.log(111);
				this.$notify.error({
					title: '错误',
					message: '上传文件只能为zip,rar包'
				});
				this.filelist = [];
				this.file = '';
				return false;
			}
			this.file = file.raw;
			this.filename = file.name;
		},

		postfile() {
			let that = this;
			if (this.file == '') {
				that.$notify.error({
					title: '错误',
					message: '上传文件不能为空'
				});
				return false;
			} else {
				let formData = new FormData();
				formData.append('file', this.file);
				this.btn.disable = true;
				this.btn.message = '上传中，请等待';
				upload(formData).then(res => {
					this.btn.disable = false;
					this.btn.message = '上传服务器';
					this.msgSuccess(res.msg);
					this.ruleForm.files = res.data;
				});
			}
		},

		submitForm(formName) {
			this.$refs[formName].validate(valid => {
				if (valid) {
					console.log(this.ruleForm);
					this.loading = true;
					addInformationFiles(this.ruleForm).then(() => {
						this.loading = false;
						this.msgSuccess('提交成功,等待审核');
						this.ruleForm.del_id = '';
						this.$router.push({
							path: '/dataFile'
						});
					});
				} else {
					return false;
				}
			});
		}
	}
};
</script>

<style scoped lang="scss">
.conent-top {
	background-color: #ffffff;
	height: 100%;
}
/deep/.el-form-item__label {
	text-align: right;
}
.btnSubmit {
	background-color: #2f6bbb;
	margin-top: 4rem;
}
</style>
